<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class CI_Offline_payment_entity{
	var $id = 0;
	var $user_id = 0;
	var $package_id = 0;
	var $coin = 0;
	var $status = "";
	var $create_date = 0;
	var $payment_type = "";
	var $attachment = "";
	var $bank_name = "";
	var $bank_branch = "";
	var $deposited_date = 0;
	var $remitter_ac_name = "";
	var $remitter_ac_number = "";
	var $remitter_bank_name = "";
	var $transfer_date = 0;
	var $transfer_time = "";
	var $transaction_id = "";
	var $dd_no = "";
	var $dd_bank_name = "";
	var $remitter_address = "";
	var $dd_date = 0;
	var $emoney_order_no = "";
	var $emoney_remitter_address = "";
	var $emoney_order_date = 0;
	
	function __destruct() {}
	function __construct() {}
    
	function init($cmd, $input)
	{
		$ci=& get_instance();
		
		if($cmd == 'id')
		{
			$result = $ci->db->where('id',$input)->get(TBL_OFFLINE_PAYMENT)->result();
		}
		else
		{
			return false;
		}
		
		if( !empty($result) )
		{
			$this->id = $result[0]->id;
			$this->user_id = $result[0]->user_id;
			$this->package_id = $result[0]->package_id;
			$this->coin = $result[0]->coin;
			$this->status = $result[0]->status;
			$this->create_date = $result[0]->create_date;
			$this->payment_type = $result[0]->payment_type;
			$this->attachment = $result[0]->attachment;
			$this->bank_name = $result[0]->bank_name;
			$this->bank_branch = $result[0]->bank_branch;
			$this->deposited_date = $result[0]->deposited_date;
			$this->remitter_ac_name = $result[0]->remitter_ac_name;
			$this->remitter_ac_number = $result[0]->remitter_ac_number;
			$this->remitter_bank_name = $result[0]->remitter_bank_name;
			$this->transfer_date = $result[0]->transfer_date;
			$this->transfer_time = $result[0]->transfer_time;
			$this->transaction_id = $result[0]->transaction_id;
			$this->dd_no = $result[0]->dd_no;
			$this->dd_bank_name = $result[0]->dd_bank_name;
			$this->remitter_address = $result[0]->remitter_address;
			$this->dd_date = $result[0]->dd_date;
			$this->emoney_order_no = $result[0]->emoney_order_no;
			$this->emoney_remitter_address = $result[0]->emoney_remitter_address;
			$this->emoney_order_date = $result[0]->emoney_order_date;
			
			return $this;
		}
		return false;
	}
	
	function setUserId($input){ $this->user_id=$input; }
	function setPackageId($input){ $this->package_id=$input;}
	function setCoin($input){ $this->coin=$input; }
	function setStatus($input){ $this->status=$input;}
	function setCreateDate($input){ $this->create_date=$input; }
	function setPaymentType($input){ $this->payment_type=$input;}
	function setAttachment($input){ $this->attachment=$input;}
	function setBankName($input){ $this->bank_name=$input;}
	function setBankBranch($input){ $this->bank_branch=$input;}
	function setDepositedDate($input){ $this->deposited_date=$input; }
	function setRemitterAcName($input){ $this->remitter_ac_name=$input; }
	function setRemitterAcNumber($input){ $this->remitter_ac_number=$input; }
	function setRemitterBankName($input){ $this->remitter_bank_name=$input; }
	function setTransferDate($input){ $this->transfer_date=$input; }
	function setTransferTime($input){ $this->transfer_time=$input; }
	function setTransactionId($input){ $this->transaction_id=$input; }
	function setDdNo($input){ $this->dd_no=$input; }
	function setDdBankName($input){ $this->dd_bank_name=$input; }
	function setRemitterAddress($input){ $this->remitter_address=$input; }
	function setDdDate($input){ $this->dd_date=$input; }
	function setEmoneyOrderNo($input){ $this->emoney_order_no=$input; }
	function setEmoneyRemitterAddress($input){ $this->emoney_remitter_address=$input; }
	function setEmoneyOrderDate($input){ $this->emoney_order_date=$input; }	
	
	function getId(){ return $this->id; }
	function getUserId(){ return $this->user_id; }
	function getPackageId(){ return $this->package_id;}
	function getCoin(){ return $this->coin;}
	function getStatus(){ return $this->status;}
	function getCreateDate(){ return $this->create_date;}
	function getPaymentType(){ return $this->payment_type;}
	function getAttachment(){ return $this->attachment;}
	function getBankName(){ return $this->bank_name;}
	function getBankBranch(){ return $this->bank_branch;}
	function getDepositedDate(){ return $this->deposited_date; }
	function getRemitterAcName(){ return $this->remitter_ac_name; }
	function getRemitterAcNumber(){ return $this->remitter_ac_number; }
	function getRemitterBankName(){ return $this->remitter_bank_name; }
	function getTransferDate(){ return $this->transfer_date; }
	function getTransferTime(){ return $this->transfer_time; }
	function getTransactionId(){ return $this->transaction_id; }
	function getDdNo(){ return $this->dd_no; }
	function getDdBankName(){ return $this->dd_bank_name; }
	function getRemitterAddress(){ return $this->remitter_address; }
	function getDdDate(){ return $this->dd_date; }
	function getEmoneyOrderNo(){ return $this->emoney_order_no; }
	function getEmoneyRemitterAddress(){ return $this->emoney_remitter_address; }
	function getEmoneyOrderDate(){ return $this->emoney_order_date; }	
	
	
	function getAttachmentFileStorage(){ 
		return "./uploads/default/users/".$this->getUserId()."/".$this->getAttachment(); 
	}
	
	function update()
	{
		$ci=& get_instance();
		 
		$ci->db->set('user_id', $this->user_id);
		$ci->db->set('package_id', $this->package_id);
		$ci->db->set('coin', $this->coin);
		$ci->db->set('status', $this->status);
		$ci->db->set('create_date', $this->create_date);
		$ci->db->set('payment_type', $this->payment_type);
		$ci->db->set('attachment', $this->attachment);
		$ci->db->set('bank_name', $this->bank_name);
		$ci->db->set('bank_branch', $this->bank_branch);
		$ci->db->set('deposited_date', $this->deposited_date);
		$ci->db->set('remitter_ac_name', $this->remitter_ac_name);
		$ci->db->set('remitter_ac_number', $this->remitter_ac_number);
		$ci->db->set('remitter_bank_name', $this->remitter_bank_name);
		$ci->db->set('transfer_date', $this->transfer_date);
		$ci->db->set('transfer_time', $this->transfer_time);
		$ci->db->set('transaction_id', $this->transaction_id);
		$ci->db->set('dd_no', $this->dd_no);
		$ci->db->set('dd_bank_name', $this->dd_bank_name);
		$ci->db->set('dd_bank_name', $this->dd_bank_name);
		$ci->db->set('remitter_address', $this->remitter_address);
		$ci->db->set('dd_date', $this->dd_date);
		$ci->db->set('emoney_order_no', $this->emoney_order_no);
		$ci->db->set('emoney_remitter_address', $this->emoney_remitter_address);
		$ci->db->set('emoney_order_date', $this->emoney_order_date);
		
		$ci->db->where('id', $this->id)->update(TBL_OFFLINE_PAYMENT);
	}
	
	function createNewEntity(){
		$ci=& get_instance();
		$ci->db->set('create_date',time());
		$ci->db->insert(TBL_OFFLINE_PAYMENT);
		return $ci->db->insert_id();
	}
	
}
